Image data, such as those contained in a video, may contain large amount of information relating to color, pixel location, and time. In order to handle such large amount of information, it may be necessary to compress or encode the image data, without losing too much information from the original video, while at the same time, without increasing the complexity of the data compression, which might decrease the speed of image data processing. Encoded image data may need to be decoded later to convert back or restore the original video information.
To encode an image, pixel color data may be first transformed to color data in an appropriate color-space coordinate system. Then, the transformed data is encoded. For example, the image data may have raw pixel color data in a Red-Green-Blue (RGB) color space coordinate system. To encode the image data, the raw pixel color data in RGB color space may be transformed into color data in a YCbCr color space coordinate system, by separating the luminance component and the color component. Then, the color data in YCbCr color space coordinate system may be encoded. By doing so, redundant information that might exist between the original three colors may be compressed by removing the redundancy during the color space transform.
Additional redundancies in the image data may be removed during the encoding of the transformed image data, by performing spatial prediction and temporal prediction, followed by additional encoding of any remaining residual data to any extent that is desirable, as well as by entropy encoding of the data in an individual frame in a point in time and/or of the data in a duration of the video sequence. Spatial prediction may predict image data in a single frame in time to eliminate redundant information between different pixels in the same frame. Temporal prediction may predict image data in a duration of the video sequence to eliminate redundant information between different frames. A residue image may be generated from the difference between the non-encoded image data and the predicted image data.
Some color space formats, such as RGB 4:4:4, may be less efficient to code natively since the different color planes may have not been effectively de-correlated. That is, redundant information may exist between different components that may not be removed during encoding, resulting in a reduced coding efficiency versus an alternative color space. On the other hand, it may be undesirable to encode this material in an alternative color space such as YUV 4:4:4 or YCoCg and YCoCg-R 4:4:4 in some applications, because of the color transformation that may have to be performed outside the coding loop, as well as possible losses that may be introduced through the color transformation.
Thus, there is a need for an improved way of transforming and encoding image data efficiently.